<?php
require './user.php';
require './function.php';
require './form.class.php';
if(!$edit=unserialize(file_get_contents('./data/edit#'.$_GET['path']))) {
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
Error：404
HTML;
exit;
}
$path=$edit['path'];
$p=floor($_GET['p']);
if($p=='-1')
 $p=floor($_GET['p2'])-1;
if($p<=0) $p=0;
form::someinput_set($_SESSION['editset']);
//header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－编辑</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head><body>
HTML;
/*<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;*/
echo '<a href="index.php?path='._encode($dir=dirname($path)).'">…',substr(realpath($dir),-10,10),'</a>/';
$mylen=strlen($_SERVER['DOCUMENT_ROOT']);
$url=str_replace('\\','/',substr(realpath($path),$mylen));
echo '<a href="',$url,'">',basename($path),'</a>';
echo <<<HTML
<div class="big_board"><div class="board_title">文件管理－编辑内容</div></div>
HTML;
$cnt=count($edit['content']);
$p0=array($p-1,$p+1,$cnt-1);
echo <<<HTML
<form action="editor.php" method="get">
<input type="hidden" name="path" value="{$_GET['path']}"/>
<select name="p"><option value="{$p0[1]}">下页</option><option value="{$p0[0]}">上页</option><option value="-1">指定</option><option value="{$p}">本页</option><option value="{$p0[2]}">末页</option><option value="0">首页</option></select><input name="p2" size="2"/><input type="submit" value="Go"/>{$p0[1]}/{$cnt}页
</form>
<form action="editsave.php?path={$_GET['path']}&amp;p=$p" method="post">
HTML;
form::someinput_put('content',$edit['content'][$p],$_SESSION['editset']['size']);
echo <<<HTML
<input name="go" type="submit" value="保存"/><input type="checkbox" name="save" value="1"/>更新文件</form>
HTML;
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
</body>
</html>
HTML;
?>
